<%@ page language="java" import="java.util.*,com.fescoservice.model.*" pageEncoding="UTF-8"%>

<%
	String langfilename = "/resources/message";
	String serchOptionSel =  request.getAttribute("SerchOptionSel")==null?"":(String)request.getAttribute("SerchOptionSel");
	String serchOptionValue =  request.getAttribute("SerchOptionValueSel")==null?"":(String)request.getAttribute("SerchOptionValueSel");
	String creatorDept =  request.getAttribute("creatorDept")==null?"":(String)request.getAttribute("creatorDept");
	String custId =  request.getAttribute("custId")==null?"":(String)request.getAttribute("custId");
	
	String companyId =  request.getAttribute("companyId")==null?"":(String)request.getAttribute("companyId");
	String companyName =  request.getAttribute("companyName")==null?"":(String)request.getAttribute("companyName");
	String companyAddr =  request.getAttribute("companyAddr")==null?"":(String)request.getAttribute("companyAddr");

%>
<%@include file="../common/LocaleManager.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Fesco Service</title>
		<link rel="stylesheet" href="<%=path%>/js/jquery/themes/redmond/jquery.ui.all.css">
		<script src="<%=path%>/js/jquery/jquery-1.5.1.js"></script>
		<script src="<%=path%>/js/FormCheck.js"></script>
		<script src="<%=path%>/js/common.js"></script>
	    <script src="<%=path%>/js/resources_zh_CN.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.datepicker.js"></script>			
		<script src="<%=path%>/js/jquery/external/jquery.bgiframe-2.1.2.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.widget.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.datepicker.js"></script>	
		<script src="<%=path%>/js/jquery/ui/jquery.ui.mouse.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.button.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.draggable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.position.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.ui.resizable.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.core.js"></script>
		<script src="<%=path%>/js/jquery/ui/jquery.effects.slide.js"></script>
		<link rel="stylesheet" href="<%=path%>/css/admin.css">
	
		<style type="text/css">
		
		</style>
		<script type="text/javascript">
			$(function() {
				$("#btnAdd").button().click(function() {
					//验空
					if (!check_empty("mainForm.applyKey|finifhDate|fee|serviceCost|preDate|hrId|serviceNumber|applyType|applyArea","<%=resource.getString("FS_T_APPLICATION_APPLY_KEY")%>|<%=resource.getString("FS_T_APPLICATION_FINISH_DATE")%>|<%=resource.getString("FS_T_APPLICATION_FEE")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>|<%=resource.getString("FS_T_APPLICATION_PRE_DATE")%>|<%=resource.getString("FS_T_APPLICATION_HR_ID")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_NUMBER")%>|<%=resource.getString("FS_T_APPLICATION_APPLY_TYPE")%>||<%=resource.getString("FS_T_APPLICATION_APPLY_AREA")%>"))
						return false;
					
					//验长度
					if (!check_length_zhCN("mainForm.fee|serviceCost|hrId|serviceNumber|memo","10|10|40|30|400"," <%=resource.getString("FS_T_APPLICATION_FEE")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>|<%=resource.getString("FS_T_APPLICATION_HR_ID")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_NUMBER")%>|<%=resource.getString("FS_T_APPLICATION_MEMO")%>")){
					    return false;
					}

					//检查数字
					if (!check_number("mainForm.fee|serviceCost","<%=resource.getString("FS_T_APPLICATION_FEE")%>|<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>")){
						return false;
					}
									
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=addApplication';
					document.forms.mainForm.submit();		
				});
				$("#btnBack").button().click(function() {
					document.forms.mainForm.action = '<%=path%>/action/Customer.htm?cmd=list';
					document.forms.mainForm.submit();		
				});
							
				
				$('#srchCompanyBtn').button().click(function (){					
					var compId = $('#companyInput').val();
					$("#companyList").load("<%=path%>/action/Manage.htm?cmd=getCompanyList&name="+compId+"&time=<%=System.currentTimeMillis()%>"); 
					$("#companyList")[0].style.display="";//.show();
					
				});
				
				
				$( "#finifhDate" ).datepicker({
					changeMonth: true,
					changeYear: true
				 });
				 $( "#preDate" ).datepicker({
					changeMonth: true,
					changeYear: true
				 });
				 
				 $( "#payDate" ).datepicker({
						changeMonth: true,
						changeYear: true
				 });
				 
				 
				 $("#companyList")[0].style.display="none";//.hide();
			});
			
			function setCompanyName() {
				var id =$("input[name='companyId']:checked").val();
				var companyName = document.forms.company['compName'+id].value;
				var companyAddr = document.forms.company['compAddr'+id].value;
				$("#companyInput").val(companyName);
				$("#companyAddrInput").val(companyAddr);
				$("#companyIdInput").val(id);
				$("#companyList")[0].style.display="none";
			}
			function checkId(value){
				ManageAjaxController.checkId(value,
						{callback:function(dataFromServer){
								if("true"=dataFromServer){
									$("#IdRepeatTips").style.display="inline";
								}else{
									$("#IdRepeatTips").style.display="none";
								}
							} 
						}); 	
			}

		</script>
	</head>
	<body>
		
		<div class="wrapContent">	
			<div class="ui-widget">	
				<div class="ui-widget-header">
					<%=resource.getString("FS_T_ADD")%><%=resource.getString("FS_T_APPLICATION")%>
				</div>
				<div class="ui-widget-content operatorForm">
					<form name="mainForm" method="post">
						<fieldset >
							<label for="applyKey">
								<%=resource.getString("FS_T_APPLICATION_APPLY_KEY")%>
							</label>
							<input type="hidden" name="custId" class=" ui-corner-all" value="<%=custId %>" />	
							
							<input id="companyId" name="companyId" class=" ui-corner-all" type="hidden"  value="<%=companyId %>" />	
							<input id="companyName" name="companyName" class=" ui-corner-all" type="hidden"  value="<%=companyName %>" />	
							<input id="companyAddr" name="companyAddr" class=" ui-corner-all" type="hidden"  value="<%=companyAddr %>" />	
							
							<% if("1".equals(creatorDept)){%> 
							    <select name="applyKey" id="applyKey" class=" ui-corner-all">				
									<option value="A"><%=resource.getString("FS_T_APPLICATION_KEY_WORK_AUTH")%></option>
									<option value="B"><%=resource.getString("FS_T_APPLICATION_KEY_VISA_INVITATION")%></option>
									<option value="C"><%=resource.getString("FS_T_APPLICATION_KEY_WORK")%></option>
									<option value="D"><%=resource.getString("FS_T_APPLICATION_KEY_LIVE_AUTH")%></option>
									<option value="E"><%=resource.getString("FS_T_APPLICATION_KEY_WORK_DELAY")%></option>
								</select>
							
							<% }%>
							<% if("2".equals(creatorDept)){%> 
							    <select name="applyKey" id="applyKey" class=" ui-corner-all">				
									<option value="F"><%=resource.getString("FS_T_APPLICATION_KEY_DRIVE")%></option>
								</select>
							
							<% }%>
							<% if("3".equals(creatorDept)){%> 
							    <select name="applyKey" id="applyKey" class=" ui-corner-all">				
									<option value="G"><%=resource.getString("FS_T_APPLICATION_KEY_ABORD")%></option>
								</select>							
							<% }%>
						</fieldset>
						
						<fieldset>
							<label for="finifhDate">
								<%=resource.getString("FS_T_APPLICATION_FINISH_DATE")%>
							</label>
							<input type="hidden" name="SerchOptionSel" class=" ui-corner-all" value="<%=serchOptionSel %>" />	
							<input type="hidden" name="SerchOptionValueSel" class=" ui-corner-all" value="<%=serchOptionValue %>" />
							<input id="finifhDate" name="finifhDate" class=" ui-corner-all" type="text" readOnly="true"/> <br>										
						</fieldset>
						
						<fieldset >
							<label for="fee">
								<%=resource.getString("FS_T_APPLICATION_FEE")%>
							</label>
							<input type="text" name="fee" class=" ui-corner-all" value="" maxlength = "10"  />
						</fieldset>

						
						<fieldset >
							<label for="serviceCost">
								<%=resource.getString("FS_T_APPLICATION_SERVICE_COST")%>
							</label>
							<input id="serviceCost" type="text" name="serviceCost" class=" ui-corner-all" value="" maxlength = "10"  />
						</fieldset>
						
						
						<fieldset >
							<label for="preDate">
								<%=resource.getString("FS_T_APPLICATION_PRE_DATE")%>
							</label>
							<input id="preDate" name="preDate" class=" ui-corner-all" type="text" readOnly="true"/> <br>
						</fieldset>
						
						<fieldset >
							<label for="payDate">
								<%=resource.getString("FS_T_APPLICATION_PAY_DATE")%>
							</label>
							<input id="payDate" name="payDate" class=" ui-corner-all" type="text" readOnly="true"/> <br>
						</fieldset>
						
						<fieldset >
							<label for="hrId">
								<%=resource.getString("FS_T_APPLICATION_HR_ID")%>
							</label>
							<input id="hrId" type="text" name="hrId" class=" ui-corner-all" value="" maxlength = "40"  />
						</fieldset>
					
						<fieldset >
							<label for="serviceNumber">
								<%=resource.getString("FS_T_APPLICATION_SERVICE_NUMBER")%>
							</label>
							<input id="serviceNumber" type="text" name="serviceNumber" class=" ui-corner-all" value="" maxlength = "30"  />
						</fieldset>
						<fieldset >
							<label for="applyType">
								<%=resource.getString("FS_T_APPLICATION_APPLY_TYPE")%>
							</label>
							<select name="applyType" id="applyType" class=" ui-corner-all">				
								<option value="1"><%=resource.getString("FS_T_APPLY_FIRST")%></option>
								<option value="2"><%=resource.getString("FS_T_APPLY_CONTINUE")%></option>
							</select>			
						</fieldset>
						
						<fieldset >
							<label for="status">
								<%=resource.getString("FS_T_APPLICATION_STATUS")%>
							</label>
							<select name="status" id="status" class=" ui-corner-all">				
								<option value="1"><%=resource.getString("FS_T_APPLICATION_OPER_STATUS_NOT")%></option>
								<option value="2"><%=resource.getString("FS_T_APPLICATION_OPER_STATUS_ING")%></option>
								<option value="3"><%=resource.getString("FS_T_APPLICATION_OPER_STATUS_FINISH")%></option>
							</select>			
						</fieldset>
						
						
						
					  <fieldset >
							<label for="applyArea">
								<%=resource.getString("FS_T_APPLICATION_APPLY_AREA")%>
							</label>
							<select name="applyArea" id="applyArea" class=" ui-corner-all">				
								<option value="1" ><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_1")%></option>
								<option value="2" ><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_2")%></option>
								<option value="3" ><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_3")%></option>
								<option value="4" ><%=resource.getString("FS_T_APPLICATION_APPLY_AREA_4")%></option>
							</select>			
						</fieldset>
					
						
						
			<!-- 		
						
						<fieldset >
							<label for="feeStatus">
								<%=resource.getString("FS_T_APPLICATION_FEE_STATUS")%>
							</label>
							<select name="feeStatus" id="feeStatus" class=" ui-corner-all">				
								<option value="1"><%=resource.getString("FS_T_APPLICATION_FEE_STATUS_NOT")%></option>
								<option value="2"><%=resource.getString("FS_T_APPLICATION_FEE_STATUS_FINISH")%></option>
							</select>			
						</fieldset>
						 -->	

						<fieldset >
							<label for="memo">
								<%=resource.getString("FS_T_APPLICATION_MEMO")%>
							</label>
							<input id="memo" type="text" name="memo" class=" ui-corner-all" value="" maxlength = "400"  />
						</fieldset>
					</form>	
					<div class="clear"></div>
				</div>			
				<div class="buttonGroupRight">
			   		<div id="btnAdd" ><%=resource.getString("FS_T_SAVE")%></div>
					<div id="btnBack" ><%=resource.getString("FS_T_LIST")%></div>
				</div>		
			</div>
		</div>
		<div id="companyList" >
		
		</div>
		<script type="text/javascript"	>	
		//import scripts below to pages which display in right frame, for ajust the scroll height
		parent.scroll(0,0);
		parent.setFrameHeight(document.body.scrollHeight+200);
		</script>
	</body>
</html>